<!--
 * @Author: LiZn
 * @Date: 2021-08-20 00:14:47
 * @LastEditTime: 2021-08-22 11:12:52
 * @LastEditors: LiZn
 * @Description: file content
 * @FilePath: \todaynews\src\views\Home.vue
-->
<template>
  <div id="home">
    <!-- <keep-alive include="Home"> -->
    <NewsList :news="news" />
    <input type="text" value="asdasdas" />
    <p>liznaaaa</p>
    <!-- </keep-alive> -->
    123master
    dev-home
    dev-home2
    dev-test
    2
    bianji
    要变基啦
    git 提交
  </div>
</template>

<script>
import NewsList from "@/components/newslist";
export default {
  name: 'Home',
  data() {
    return {
      data2: "123",
      news: [
        {
          title: '美女帅哥',
          imgsrc: [require('@/assets/imgs/m1.png'), require('../assets/imgs/m1.png'), require('../assets/imgs/m3.jpg')],
          id: 1
        },
        {
          title: '美女帅哥',
          imgsrc: [require('@/assets/imgs/m1.png'), require('../assets/imgs/m1.png'), require('../assets/imgs/m2.jpg')],
          id: 1
        }
      ]
    }
  },
  components: {
    NewsList,
  },
  mounted() {
  },
  beforeRouteLeave(to, from, next) {
    const topHeight = document.documentElement.scrollTop
    this.$store.commit("setIncludes", topHeight)
    next()
  },
  beforeRouteEnter(to, from, next) {
    next(vm => {
      vm.$nextTick(() => {
        document.documentElement.scrollTop = vm.$store.state.homeTop;
      })
    })
  }
}
</script>
